/**
* 版权声明：睿商(厦门)科技股份有限公司 版权所有 违者必究
* 日    期：2021-07-06
*/
package com.rzico.admin.service;

import com.rzico.admin.entity.Company;
import com.rzico.base.BaseMapper;
import com.rzico.base.impl.BaseServiceImpl;
import com.rzico.admin.entity.ProjectActivity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.rzico.admin.mapper.ProjectActivityMapper;

import java.util.Date;

/**
 * <pre>
 * 项目活动记录表业务类
 * </pre>
 *
 * @author Rzico Boot
 * @version 1.0
 */
@Service
public class ProjectActivityService extends BaseServiceImpl<ProjectActivity, String> {

    @Autowired
    private ProjectActivityMapper projectActivityMapper;

    @Override
    public BaseMapper<ProjectActivity, String> getMapper() {
        return projectActivityMapper;
    }

    //审核
    public int adopt(Long projectActivityId){
        ProjectActivity projectActivity=projectActivityMapper.selectByPrimaryKey(projectActivityId);
        projectActivity.setModifyDate(new Date());
        projectActivity.setStatus(2);

        int result=projectActivityMapper.updateByPrimaryKeySelective(projectActivity);
        return result;
    }
    //驳回
    public int reject(Long projectActivityId,String rejectText){
        ProjectActivity projectActivity=projectActivityMapper.selectByPrimaryKey(projectActivityId);
        projectActivity.setModifyDate(new Date());
        projectActivity.setStatus(3);
        projectActivity.setMemo(rejectText);

        int result=projectActivityMapper.updateByPrimaryKeySelective(projectActivity);
        return result;
    }

    //提交
    public int submit(Long projectActivityId){
        ProjectActivity projectActivity=projectActivityMapper.selectByPrimaryKey(projectActivityId);
        projectActivity.setModifyDate(new Date());
        projectActivity.setStatus(1);

        int result=projectActivityMapper.updateByPrimaryKeySelective(projectActivity);
        return result;
    }
}
